home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / AppleShare API / ServerControl / ServerControlIntf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-12  |  9.4 KB  |  317 lines  |  [TEXT/MPS ]

  1. /*
  2. Created: Monday, April 27, 1992 at 2:50 PM
  3.     ServerControlIntf.h
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc. 1990-1992
  7.         All rights reserved
  8.     
  9.     4/10/95        JML        Added alignment pragmas
  10.  
  11. */
  12.  
  13. #ifndef __APPLETALK__
  14. #include <AppleTalk.h>
  15. #endif
  16.  
  17. #if GENERATINGPOWERPC
  18. #pragma options align=mac68k
  19. #endif
  20.  
  21. #define    ServerDispatch    0xA094    /* The server control dispatch trap. */
  22.  
  23. /* scCode values */
  24. enum {
  25.     SCStartServer = 0,
  26.     SCShutDown = 2,
  27.     SCCancelShutDown = 3,
  28.     SCDisconnect = 4,
  29.     SCPollServer = 5,
  30.     SCGetExpFldr = 6,
  31.     SCGetSetupInfo = 7,
  32.     SCSetSetupInfo = 8,
  33.     SCSendMessage = 9,
  34.     SCGetServerStatus = 10,
  35.     SCInstallServerEventProc = 11,
  36.     SCRemoveServerEventProc = 12,
  37.     SCGetServerEventProc = 13,
  38.     SCServerVersion = 14,
  39.     SCSetCopyProtect = 16,
  40.     SCClrCopyProtect = 17,
  41.     SCDisconnectVolUsers = 18,
  42.     SCGetUserNameRec = 19,
  43.     SCGetUserMountInfo = 20,
  44.     SCWakeServer = 21,
  45.     SCSleepServer = 22
  46. };    /* all other values of scCode are reserved */
  47.  
  48. /* scFlags bits and masks for disconnectPB */
  49. #define bUNRFSendMsg    13        /* send a message */
  50. #define UNRFSendMsgMask    0x2000    /* send a message */
  51.  
  52. /* These are error codes that are returned from an SCDisconnect trap */
  53. #define    AlreadyShuttingDown        -1    /* the server is already shutting down */
  54. #define    AlreadyDisconnecting    -2    /* the server is already disconnecting */
  55.  
  56. /* scServerType contains the server type, which is interpreted as follows: */
  57. enum {
  58.     MFSType = 0x0000,    /* Macintosh File Sharing */
  59.     AFSType = 0x0001    /* AppleShare File Server */
  60. };
  61.  
  62. /* scServerVersion is the server version, which is currently interpreted as follows: */
  63. /*    $0030 : File Sharing Extension, versions 7.0 and 7.0.1 */
  64. /*    $0031 : File Server Extension, version 3.0 */
  65. /*    $0032 : File Sharing Extension, version 7.0.2 */
  66.  
  67. /* These are some random constants for SCStartServer */
  68. #define kCurInstalled    0    /* the currently installed server */
  69. #define kFinderExtn        0    /* send high level events to the finder extension */
  70.  
  71. /* scServerFlags bits returned by SCGetServerStatus */
  72. #define bJBSEnabled                12        /* Set if Apple II boot service is enabled */
  73.  
  74. /* These "SCPS" integers are passed back from a SCPollServer call in scServerState: */
  75. /* 0 means: 0 <= seconds left < 30 and Network Setup says : "Less than a minute" */
  76. /* 1 means: 30 <= seconds left < 90 and Network Setup says : "About a minute" */
  77. /* 2 thru 4094: x*60-30 <= seconds left < x*60+30 and NS says: "About X minutes" */
  78. enum {
  79.     SCPSRunning = -1,        /* Server running normally */
  80.     SCPSStartingUp = -2,    /* Server is in the process of starting up */
  81.     SCPSJustDisabled = -3,    /* Server is just disabled and there was no startup error */
  82.     SCPSDisabledwErr = -4,    /* Server is disabled and there is an "SE" error in scServerError */
  83.     SCPSSleeping = -5        /* Server is temporarily disabled */
  84. };
  85.  
  86. /* These "SCPD" integers are passed back from a SCPollServer call in scDisconnectState: */
  87. /* 0 means: 0 <= seconds left < 30 and FileShare Monitor says : "Less than a minute" */
  88. /* 1 means: 30 <= seconds left < 90 and FileShare Monitor says : "About a minute" */
  89. /* 2 thru 4094: x*60-30 <= seconds left < x*60+30 and FM says: "About X minutes" */
  90. enum {
  91.     SCPDNotDisconnecting = -1    /* Server not disconnecting some one or some group of users */
  92. };
  93.  
  94. /* These are Server Errors ("SE") error codes returned in scServerError by a SCPollServer call */
  95. enum {
  96.     SENoUGFileOpenErr = 1,        /* "The Users & Groups file could not be opened." */
  97.     SENoRealVolsErr = 2,        /* "There are no volumes for AppleShare to use." */
  98.     SEInsuffMFMemErr = 4,        /* "There was not enough memory available to start AppleShare File Service." */
  99.     SECantRegNameErr = 5,        /* "The File Server's name could not be registered on the AppleTalk Network." */
  100.     SECantFindExtnFolder = 6,    /* "The File Server could not be started because the Extensions folder could not be found" */
  101.     SEUnExATalkErr = 7,            /* "An unexpected AppleTalk error occurred." */
  102.     SENoMachineName = 8,        /* "You must have a machine name." */
  103.     SECantFindFSExtn = 9,        /* "The File Server could not be started because the File Sharing Extension could not be found" */
  104.     SEATalkOffErr = 10,            /* "Appletalk is turned off." */
  105.     SEAppleTalkErr = 11,        /* "AppleTalk could not be activated." */
  106.     SENoInitRunErr = 12,        /* "AppleShare Setup file is not installed in the Server Folder." */
  107.     SESysTooOldErr = 13,        /* "The System File is too old for AppleShare (v3.0)." */
  108.     SEInsuffAppMemErr = 14,        /* "There was not enough memory for FileShare to startup." */
  109.     SEBadConfigErr = 15,        /* "AppleShare encountered a problem with the current configuration." */
  110.     SENoDTOnStartupErr = 16,    /* "The Desktop database on volume the startup volume could not be opened." */
  111.     SEDupNameErr = 17            /* "Duplicate name error when registering.  Please choose another name." */
  112. };
  113.  
  114. typedef unsigned char tLoginMsg[199];
  115.  
  116. struct SetupInfoRec {
  117.     short        SIVersion;            /* SetupInfoRec version: 1 for File Sharing and AppleShare 3.0 */
  118.     short        SIFlags;            /* 0 for File Sharing and AppleShare 3.0 */
  119.     short        SIMaxLogins;        /* 1..11 for File Sharing; 1..121 for AppleShare 3.0 */
  120.     short        SISrvrUsageLimit;    /* 10 to 100 (percent) */
  121.     /* All remaining fields in record are only used by the AppleShare file server */
  122.     Point        SIVolInfoLocation;    /* location of Volume Info window (default is -1,-1) */
  123.     Boolean        SIVolInfoVisible;    /* is Volume Info window visible (default is TRUE) */
  124.     Point        SIUserInfoLocation;    /* location of Connected Users window (default is -1,-1) */
  125.     Boolean        SIUserInfoVisible;    /* is Connected Users window visible (default is TRUE) */
  126.     short        SIShutDownMins;        /* default minutes until shutdown */
  127.     short        SISpare[17];        /* reserved */
  128.     tLoginMsg    SILoginMsg;            /* the current Login message */
  129. };
  130.  
  131. typedef struct SetupInfoRec SetupInfoRec;
  132. typedef SetupInfoRec *SetupInfoRecPtr;
  133.  
  134.  
  135. typedef long *LongIntPtr;            /* because C doesn't have such a thing?? */
  136.  
  137. #define    SCParamBlockHeader \
  138.     QElemPtr qLink;\
  139.     short qType;\
  140.     short ioTrap;\
  141.     Ptr ioCmdAddr;\
  142.     ProcPtr ioCompletion;\
  143.     OSErr ioResult;
  144.  
  145.  
  146. struct StartParam {
  147.     SCParamBlockHeader
  148.     long    reserved;
  149.     short    reserved2;
  150.     short    reserved3;
  151.     short    scCode;
  152.     short    scStartSelect;
  153.     short    scEventSelect;
  154.     long    reserved4[4];
  155. };
  156.  
  157. typedef struct StartParam StartParam;
  158.  
  159. struct DisconnectParam {
  160.     SCParamBlockHeader
  161.     LongIntPtr    scDiscArrayPtr;
  162.     short        scArrayCount;
  163.     short        reserved;
  164.     short        scCode;
  165.     short        scNumMinutes;
  166.     short        scFlags;
  167.     StringPtr    scMessagePtr;
  168. };
  169.  
  170. typedef struct DisconnectParam DisconnectParam;
  171.  
  172. struct PollServerParam {
  173.     SCParamBlockHeader
  174.     long    reserved;
  175.     short    reserved2;
  176.     short    reserved3;
  177.     short    scCode;
  178.     short    scServerState;
  179.     short    scDisconnectState;
  180.     short    scServerError;
  181.     long    scSecondsLeft;
  182. };
  183.  
  184. typedef struct PollServerParam PollServerParam;
  185.  
  186. struct StandardParam {
  187.     SCParamBlockHeader
  188.     StringPtr    scNamePtr;
  189.     short        scVRefNum;
  190.     short        scLogins;
  191.     short        scCode;
  192.     short        scIndex;
  193.     long        scDirID;
  194. };
  195.  
  196. typedef struct StandardParam StandardParam;
  197.  
  198. struct SetupParam {
  199.     SCParamBlockHeader
  200.     SetupInfoRecPtr    scSetupPtr;
  201.     short            scMaxVolumes;
  202.     short            scMaxExpFolders;
  203.     short            scCode;
  204.     short            scCurMaxSessions;
  205. };
  206.  
  207. typedef struct SetupParam SetupParam;
  208.  
  209. struct StatusParam {
  210.     SCParamBlockHeader
  211.     StringPtr    scNamePtr;
  212.     short        reserved2;
  213.     short        reserved3;
  214.     short        scCode;
  215.     short        scServerFlags;
  216.     short        scNumSessions;
  217.     long        scUserListModDate;
  218.     short        scActivity;
  219.     long        scVolListModDate;
  220. };
  221.  
  222. typedef struct StatusParam StatusParam;
  223.  
  224. struct ServerEventParam {
  225.     SCParamBlockHeader
  226.     Ptr        scSEQEntryPtr;
  227.     short    reserved2;
  228.     short    reserved3;
  229.     short    scCode;
  230. };
  231.  
  232. typedef struct ServerEventParam ServerEventParam;
  233.  
  234. struct    VersionParam {
  235.     SCParamBlockHeader
  236.     StringPtr    scExtNamePtr;
  237.     short        reserved2;
  238.     short        reserved3;
  239.     short        scCode;
  240.     short        scServerType;
  241.     short        scServerVersion;
  242. };
  243.  
  244. typedef struct VersionParam VersionParam;
  245.  
  246. struct UserInfoParam {
  247.     SCParamBlockHeader
  248.     StringPtr    scNamePtr;
  249.     short        reserved2;
  250.     short        reserved3;
  251.     short        scCode;
  252.     long        scPosition;
  253.     long        scUNRecID;
  254.     long        scUserID;
  255.     long        scLoginTime;
  256.     long        scLastUseTime;
  257.     AddrBlock    scSocketNum;
  258. };
  259.  
  260. typedef struct UserInfoParam UserInfoParam;
  261.  
  262. struct VolMountedParam {
  263.     SCParamBlockHeader
  264.     Ptr            reserved;
  265.     short        scVRefNum;
  266.     short        reserved3;
  267.     short        scCode;
  268.     short        scFilesOpen;
  269.     short        scWriteableFiles;
  270.     long        scUNRecID;
  271.     Boolean        scMounted;
  272.     Boolean        scMountedAsOwner;
  273. };
  274.  
  275. typedef struct VolMountedParam VolMountedParam;
  276.  
  277. union SCParamBlockRec {
  278.     StartParam            startPB;
  279.     DisconnectParam        disconnectPB;
  280.     PollServerParam        pollServerPB;
  281.     StandardParam        standardPB;
  282.     SetupParam            setupPB;
  283.     StatusParam            statusPB;
  284.     ServerEventParam    serverEventPB;
  285.     VersionParam        versionPB;
  286.     UserInfoParam        userInfoPB;
  287.     VolMountedParam        volMountedPB;
  288. };
  289.  
  290. #ifndef __cplusplus
  291. typedef union SCParamBlockRec SCParamBlockRec;
  292. #endif    // __cplusplus
  293.  
  294. typedef SCParamBlockRec *SCParamBlockPtr;
  295.  
  296. /* ServerDispatch can be called synchronously only. */
  297. /* Asynchronous server control calls are not supported. */
  298. /* Inputs:     A0 points to the SCParamBlockRec. */
  299. /*            D0 must be zero. */
  300. /*            SCParamBlockRec.scCode indicates the server control call. */
  301. /* Outputs:    D0.w and SCParamBlockRec.ioResult contain the result code. */
  302. /* Note:        Macintosh File Sharing does not return the result in D0.w */
  303. /*            so the glue code below moves it there for you. */
  304.  
  305. /* The glue to call the ServerDispatch trap */
  306. #if !GENERATINGCFM
  307. #pragma parameter __D0 SyncServerDispatch(__A0)
  308. #endif
  309. extern    pascal OSErr SyncServerDispatch(SCParamBlockPtr PBPtr)
  310.     FOURWORDINLINE(    0x7000,            /* MOVEQ      #$00,D0        */
  311.                     0xA094,            /* _ServerDispatch           */
  312.                     0x3028,0x0010);    /* MOVE.W    ioResult(A0),D0    */
  313.  
  314. #if GENERATINGPOWERPC
  315. #pragma options align=reset
  316. #endif
  317.